<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            background-color: yellowgreen;
            display: flex;
        }
        
        .item {
            width: 100px;
            height: 100px;
            background-color: tomato;
            font-size: 40px;
            text-align: center;
            line-height: 100px;
            color: #fff;
            border: 2px solid black;
        }
        /*修改的是项目内容*/
        
        .box>.item:nth-child(1) {
            /*重新排序*/
            order: 2;
        }
        
        .box>.item:nth-child(2) {
            /*项目的放大比例(只针对富余空间才有效)*/
            flex-grow: 1;
        }
        
        .box>.item:nth-child(3) {
            /*项目缩小比例    0代表不缩小   别的值大于1就是缩小比例更大*/
            flex-shrink: 0;
        }
        
        .box>.item:nth-child(4) {
            /*当设置自动尺寸之后原宽度失效*/
            flex-basis: 150px;
        }
        
        .box>.item:nth-child(5) {
            /*不放大比例  也不缩小比例 固定大小*/
            flex: 0 0 150px;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="item">1</div>
        <div class="item">2</div>
        <div class="item">3</div>
        <div class="item">4</div>
        <div class="item">5</div>
        <div class="item">6</div>
        <div class="item">7</div>
    </div>
</body>

</html>